const query = require('../agora/IntervalQuery');
const logger = require('../utils').getLogger(__filename);
const { modifyMeetingTimestampDiff, writeEventWhenError400,writeEventWhenExitStatus } = require("../meeting/meeting-event")

query.on('info', async (ret, info, key) => {
	logger.info(`${key}:${JSON.stringify(ret)}`)
	logger.info(`info:${JSON.stringify(info)}`)
	await modifyMeetingTimestampDiff(ret, info, key)
	await writeEventWhenExitStatus(ret, info, key)
})
query.on('error', async (err, info, key) => {
	logger.info(`[key:${key}] info:${JSON.stringify(info)}`)
	logger.error(err)
	await writeEventWhenError400(err, info, key)
})
query.on('delete', (key) => {
	logger.error(`delete empty key:${key}`)
})
